home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Softshoe / Lisa's Portable Parts / Patterns / MatchLoop.h < prev    next >
Encoding:
Text File  |  2000-06-23  |  800 b   |  41 lines

  1. // MatchLoop.h
  2.  
  3. #ifndef MatchLoop_h
  4. #define MatchLoop_h
  5.  
  6. #ifndef ConstData_h
  7. #include "ConstData.h"
  8. #endif
  9.  
  10. class PatternMatcher;
  11.  
  12. class MatchLoop
  13.   {
  14.     private:
  15.         const PatternMatcher *pattern;
  16.         ConstData source;
  17.         const uint8 *matchEnd;
  18.         uint32 matchedPrefix;
  19.         
  20.         bool Matching() const;
  21.         bool PartiallyMatching() const;
  22.         void Advance();
  23.         
  24.     public:
  25.         MatchLoop( const PatternMatcher& );
  26.         MatchLoop( const PatternMatcher&, ConstData firstSource );
  27.         
  28.         void Start( ConstData source );
  29.         void Continue( ConstData source );
  30.         
  31.         bool Finished() const                { return matchEnd > source.End(); }
  32.         bool Unfinished() const                { return matchEnd <= source.End(); }
  33.         
  34.         void operator++();
  35.         void operator++(int)                    { operator++(); }
  36.         
  37.         const uint8 *EndOfMatch() const    { return matchEnd; }
  38.   };
  39.  
  40. #endif
  41.